import 'package:high_help_apps/common/entities/user/user_register_request_entity.dart';

userRegisterRequestEntityFromJson(UserRegisterRequestEntity data, Map<String, dynamic> json) {
	if (json['username'] != null) {
		data.username = json['username'].toString();
	}
	if (json['password'] != null) {
		data.password = json['password'].toString();
	}
	if (json['school'] != null) {
		data.school = json['school'] is String
				? int.tryParse(json['school'])
				: json['school'].toInt();
	}
	if (json['major'] != null) {
		data.major = json['major'] is String
				? int.tryParse(json['major'])
				: json['major'].toInt();
	}
	if (json['sign_time'] != null) {
		data.signTime = json['sign_time'] is String
				? int.tryParse(json['sign_time'])
				: json['sign_time'].toInt();
	}
	if (json['sex'] != null) {
		data.sex = json['sex'] is String
				? int.tryParse(json['sex'])
				: json['sex'].toInt();
	}
	if (json['nick_name'] != null) {
		data.nickName = json['nick_name'].toString();
	}
	if (json['email'] != null) {
		data.email = json['email'].toString();
	}
	if (json['phone'] != null) {
		data.phone = json['phone'].toString();
	}
	return data;
}

Map<String, dynamic> userRegisterRequestEntityToJson(UserRegisterRequestEntity entity) {
	final Map<String, dynamic> data = new Map<String, dynamic>();
	data['username'] = entity.username;
	data['password'] = entity.password;
	data['school'] = entity.school;
	data['major'] = entity.major;
	data['sign_time'] = entity.signTime;
	data['sex'] = entity.sex;
	data['nick_name'] = entity.nickName;
	data['email'] = entity.email;
	data['phone'] = entity.phone;
	return data;
}